<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        ul,
        ol {
            list-style: none;
        }

        html,
        body {
            width: 100%;
            height: 100%;
        }

        body {
            overflow: hidden;
        }

        ul {
            width: 100%;
            height: 100%;
            position: absolute;
            left: 0;
            top: 0;
        }

        ul li {
            width: 100%;
            height: 100%;
            font-size: 30px;
            text-align: center;
        }

        ol {
            position: fixed;
            top: 80px;
            left: 50px;
            border: 1px solid #fff;
        }

        ol li {
            width: 80px;
            height: 50px;
            line-height: 50px;
            text-align: center;
            cursor: pointer;
        }
    </style>
</head>

<body>
    <ul id="ul">
        <li>首页</li>
        <li>第二页</li>
        <li>第三页</li>
        <li>第四页</li>
        <li>第五页</li>
    </ul>

    <ol id="ol">
        <li>首页</li>
        <li>第二页</li>
        <li>第三页</li>
        <li>第四页</li>
        <li>第五页</li>
    </ol>


    <script>
        var ul = document.getElementById("ul");
        var uls = ul.children;
        var ol = document.getElementById("ol");
        var ols = ol.children;

        var arr = ["#FFE5D4", "#FFFCCC", "#C8EFD4", "#C8EBFA", "#D3D5F5"];

        for (var i = 0; i < uls.length; i++) {
            //背景颜色
            uls[i].style.background = arr[i];
            ols[i].style.background = arr[i];

            ols[i].index = i;
            ols[i].onclick = function () {
                target = this.index * uls[0].offsetHeight;
            }
        }

        var leader = 0;
        var target = 0;
        var clearA = null;
        clearA = setInterval(function () {
            leader = leader + (target - leader) / 10;
            scrollTo(0, leader);
            // ul.style.top = - leader + "px";
        }, 30)

    </script>
</body>

</html>